package games;

import java.io.PrintWriter;
import java.util.Scanner;

public class RankingEntry {

	private String playerName;
	private int budget;
	private int destroyedInvaders;
	private int mapId;

	public RankingEntry(final String playerName, final int mapId, final int destroyedInvaders, final int budget){
		super();

		this.playerName = playerName;
		this.mapId = mapId;		
		this.destroyedInvaders = destroyedInvaders;
		this.budget = budget;
	}
	
	public RankingEntry(final Scanner reader){
		super();

		this.playerName = reader.nextLine();
		this.mapId = reader.nextInt();		
		this.destroyedInvaders = reader.nextInt();
		this.budget = reader.nextInt();
		reader.nextLine();
	}
	

	public String getPlayerName() {
		return playerName;
	}

	public int getBudget() {
		return budget;
	}

	public int getInvadersDestroyedInvaders() {
		return destroyedInvaders;
	}

	public int getMapId() {
		return mapId;
	}

	@Override
	public String toString() {
		return "Name: " + playerName + "\n" 
				+ "Map ID: " + mapId + " Destroyed Invaders: " + destroyedInvaders + " Budget: " + budget;
	}
	
	public void writeEntry(final PrintWriter writer){
		writer.println(playerName);
		writer.println(mapId + " " + destroyedInvaders + " " + budget);
	}
	
}
